package cate.game.play.skill.passive.god;

import cate.game.attr.FightAttr;
import cate.game.play.buff.Buff;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 当被【缴械】时效果减弱至55%，对施加【缴械】的目标回敬【集火】2回合，被集火的目标受疗降低40%、受到的伤害提升15%
 */
public class 集火PH extends PassiveHandler {

	private String buff标签;

	private FightAttr 属性;

	private int 回敬buff;

	//buff标签=缴械&属性=4:4400&回敬buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		buff标签 = args.get("buff标签");
		属性 = new FightAttr(args.get("属性"));
		回敬buff = args.getInt("回敬buff", 0);
	}

	@Override
	public void onOwnerAddBuff(ActionCtx action, Buff addBuff) {
		if(addBuff.cfg.containTag(buff标签)){
			skill.owner.attr.addAttr(属性);
			addBuff.caster.buff.tryAddByTid(action, skill.owner, 回敬buff);
		}
	}

	@Override
	public void onOwnerBuffInvalid(ActionCtx action, byte invalidReason, Buff otherBuff) {
		if (otherBuff.cfg.containTag(buff标签)) {
			skill.owner.attr.addAttr(属性, false);
		}
	}
}
